package control;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import bean.Flight;

@Controller
public class HotelFlightControl {
	
	@Resource
	Dao dao;
	
	@RequestMapping(value="/addHotelToFlight",method=RequestMethod.POST)
	public @ResponseBody Flight addHotelToFlight(Integer idxFlight, Integer idxHotel)
	{
		System.out.println("addHotelToFlight");
		return dao.addHotelToFlight(idxFlight, idxHotel);
		
	}
			
	@RequestMapping(value="/removeHotelToFlight",method=RequestMethod.POST)	
	public @ResponseBody Flight removeHotelToFlight(Integer idxFlight, Integer idxHotel)
	{
		System.out.println("removeHotelToFlight");
		return dao.removeHotelToFlight(idxFlight, idxHotel);
		
	}
	
	@RequestMapping(value="/addHotelsToFlight",method=RequestMethod.POST)	
	public @ResponseBody Flight addHotelsToFlight(Integer idxFlight, String idsHotel)
	{
		
		System.out.println("addHotelsToFlight");
		return dao.addHotelsToFlight(idxFlight, Utils.getListIntegerFromString(idsHotel));
	}
	
	
	

}

